<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateVerificationCodeTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('verification_code', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('user_id')->nullable()->comment('关联用户');
            $table->string('channel', 50)->comment('发送频道，例如 mail, sms');
            $table->string('account', 100)->comment('发送账户');
            $table->string('code', 20)->comment('发送账户');
            $table->integer('state')->default(0)->comment('状态：0未使用 1已使用');
            $table->timestamps();
            $table->softDeletes();
        });
        \DB::statement("ALTER TABLE `verification_code` comment '短信验证码表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('verification_code');
    }
}
